FROM ubuntu:20.04

LABEL maintainer="lfj <1459426172@qq.com>"

# 设置用户和密码（通过构建参数）
ARG ROOT_PWD="123456"
ARG USER_PWD="123456"
RUN echo "root:${ROOT_PWD}" | chpasswd && \
    useradd -d /home/lfj -m lfj -s /bin/bash && \
    usermod -aG sudo lfj && \
    echo "lfj:${USER_PWD}" | chpasswd

# 配置语言环境
# RUN echo "LANG=en_US.UTF-8" > /etc/default/locale

# 安装编译工具和依赖
RUN apt-get update && \
    apt-get install -y \
    apt-utils \
    sudo \
    g++-aarch64-linux-gnu \
    gcc-aarch64-linux-gnu \
    cmake \
    make \
    unzip && \
    apt-get clean

# 复制并解压源码
USER lfj
WORKDIR /home/lfj
COPY mpp-1.0.9.zip .
RUN unzip mpp-1.0.9.zip && \
    rm mpp-1.0.9.zip

# 编译
WORKDIR /home/lfj/mpp-1.0.9/build/linux/aarch64
RUN ./make-Makefiles.bash && \
    make -j$(nproc) && \
    mkdir out && \
    make install DESTDIR=out

# VOLUME /home/lfj/mpp-1.0.9/build/linux/aarch64/out

# 默认启动 Shell
CMD ["/bin/bash"]
